import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Admin
 * Date: 2022-12-04
 * Time: 16:49
 */
public class Demo1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        while(scan.hasNext()) {

            int n =scan.nextInt();
            int size = 0; int count = 0;
            scan.nextLine();
            for(int i = 0; i < n; i++) {
                String str = scan.nextLine();
                String[] str1 = str.split(" ");

                if(str1[1].equals("connect")) {
                    size++;
                }else {
                    size--;
                }

                if(size > count) {
                    count =size;
                }
            }

            System.out.println(count);

        }
    }
}
